home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
graphic
/
frasr182.zip
/
MISCOVL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-18
|
58KB
|
1,870 lines
/*
Overlayed odds and ends that don't fit anywhere else.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifndef XFRACT
#include <process.h>
#include <dos.h>
#include <stdarg.h>
#include <io.h>
#else
#include <varargs.h>
#endif
#include "fractint.h"
#include "fractype.h"
#include "helpdefs.h"
#include "prototyp.h"
/* routines in this module */
static void write_batch_parms(FILE *,char *,int);
#ifndef XFRACT
static void put_parm(char *parm,...);
#else
static void put_parm();
#endif
static void put_parm_line(void);
static int getprec(double,double,double);
static void put_float(int,double,int);
static void put_filename(char *keyword,char *fname);
static void format_item(int choice,char *buf);
static int check_modekey(int curkey,int choice);
static int entcompare(VOIDCONSTPTR p1,VOIDCONSTPTR p2);
static void update_fractint_cfg(void);
extern int debugflag;
extern int xdots,ydots;
extern int cpu; /* cpu type */
extern int fpu; /* fpu type */
extern int iit; /* iit fpu? */
extern int video_type;
extern int askvideo;
extern char overwrite; /* 1 means ok to overwrite */
extern int fillcolor; /* fill color: -1 = normal*/
extern int inside; /* inside color: 1=blue */
extern int outside; /* outside color, if set */
extern double xxmin,xxmax,yymin,yymax,xx3rd,yy3rd; /* selected screen corners */
extern double sxmin, sxmax, sx3rd, symin, symax, sy3rd; /* zoom box corners */
extern double param[]; /* up to four parameters */
extern int finattract; /* finite attractor option */
extern int forcesymmetry;
extern int LogFlag; /* non-zero if logarithmic palettes */
extern int rflag, rseed;
extern int periodicitycheck;
extern int potflag; /* continuous potential flag */
extern int pot16bit; /* save 16 bit values for continuous potential */
extern double potparam[3]; /* three potential parameters*/
extern int fractype; /* if == 0, use Mandelbrot */
extern BYTE usemag;
extern long delmin;
extern int maxit; /* try this many iterations */
extern int invert; /* non-zero if inversion active */
extern double inversion[];
extern int decomp[];
extern int distest; /* non-zero if distance estimator */
extern int distestwidth;
extern int init3d[20]; /* '3d=nn/nn/nn/...' values */
extern char floatflag; /* floating-point fractals? */
extern int usr_biomorph;
extern char FormFileName[]; /* file to find (type=)formulas in */
extern char FormName[]; /* Name of the Formula (if not null) */
extern char LFileName[];
extern char LName[];
extern char IFSFileName[];
extern char IFSName[];
extern int bailout; /* user input bailout value */
extern char useinitorbit;
extern _CMPLX initorbit;
extern int display3d; /* 3D display flag: 0 = OFF */
extern int overlay3d; /* 3D overlay flag: 0 = OFF */
extern int loaded3d;
extern char readname[]; /* name of fractal input file */
extern int showfile; /* has file been displayed yet? */
extern int transparent[];
extern char preview; /* 3D preview mode flag */
extern char showbox; /* flag to show box and vector in preview */
extern int RANDOMIZE; /* Color randomizing factor */
extern int Targa_Out; /* Selects full color with light source fills */
extern int Ambient; /* Darkness of shadows in light source */
extern int haze; /* Amount of haze to factor in in full color */
extern char light_name[]; /* Name of full color .TGA file */
extern int previewfactor;
extern int BRIEF;
extern int RAY;
extern int xtrans;
extern int ytrans;
extern int red_crop_left;
extern int red_crop_right;
extern int blue_crop_left;
extern int blue_crop_right;
extern int red_bright;
extern int blue_bright;
extern int xadjust;
extern int eyeseparation;
extern int glassestype;
extern BYTE trigndx[];
extern int rotate_lo,rotate_hi;
extern int far *ranges;
extern int rangeslen;
extern char CommandFile[80];
extern char CommandName[ITEMNAMELEN+1];
extern char far CommandComment1[57];
extern char far CommandComment2[57];
extern char far CommandComment3[57];
extern char far CommandComment4[57];
extern char usr_stdcalcmode;
extern int calc_status;
extern double sxmin,sxmax,symin,symax,sx3rd,sy3rd;
/* Julibrot variables TIW 1/24/93 */
extern double mxmaxfp, mxminfp, mymaxfp, myminfp, originfp;
extern double depthfp, heightfp, widthfp, distfp, eyesfp;
extern int zdots;
extern int lastorbittype, neworbittype;
extern char *juli3Doptions[];
extern int juli3Dmode;
/* viewwindows parameters */
extern int viewwindow;
extern float viewreduction;
extern int viewcrop;
extern float finalaspectratio;
extern int viewxdots,viewydots;
extern int colorstate; /* comments in cmdfiles */
extern int colors;
extern int gotrealdac;
extern int reallyega;
extern char colorfile[];
extern int mapset;
extern char MAP_name[];
extern BYTE dacbox[256][3];
extern char far *mapdacbox;
extern int save_release;
extern char tstack[4096];
extern char s_cantopen[];
extern char s_cantwrite[];
extern char s_cantcreate[];
extern char s_cantunderstand[];
extern char s_cantfind[];
extern int calc_status;
extern struct videoinfo far videotable[];
/* fullscreen_choice options */
#define CHOICERETURNKEY 1
#define CHOICEMENU 2
#define CHOICEHELP 4
void miscovl_overlay() { } /* for restore_active_ovly */
extern char s_real[];
extern char s_imag[];
extern char s_mult[];
extern char s_sum[];
extern char s_zmag[];
extern char s_bof60[];
extern char s_bof61[];
extern char s_maxiter[];
extern char s_epscross[];
extern char s_startrail[];
extern char s_normal[];
extern char s_period[];
char *major[] = {"breadth","depth","walk","run"};
char *minor[] = {"left","right"};
static FILE *parmfile;
#define PAR_KEY(x) ( x < 10 ? '0' + x : 'a' - 10 + x)
#ifdef C6
#pragma optimize("e",off) /* MSC 6.00A messes up next rtn with "e" on */
#endif
void make_batch_file()
{
static char far hdg[]={"Save Current Parameters"};
/** added for pieces feature **/
double pdelx;
double pdely;
double pdelx2;
double pdely2;
unsigned int j, pxdots, pydots, xm, ym;
double pxxmin, pxxmax, pyymin, pyymax, pxx3rd, pyy3rd;
char vidmde[4];
int promptnum;
int piecespromts;
int have3rd;
/****/
int i;
char inpcommandfile[80], inpcommandname[ITEMNAMELEN + 1];
char inpcomment1[57], inpcomment2[57], inpcomment3[57], inpcomment4[57];
struct fullscreenvalues paramvalues[18];
char far *choices[18];
int gotinfile;
char outname[81], buf[256], buf2[128];
FILE *infile;
FILE *fpbat=NULL;
char colorspec[14];
int maxcolor;
int maxcolorindex;
char *sptr, *sptr2;
int oldhelpmode;
ENTER_OVLY(OVLY_MISCOVL);
stackscreen();
oldhelpmode = helpmode;
helpmode = HELPPARMFILE;
strcpy(colorspec, "n");
maxcolor = colors;
if (gotrealdac && !reallyega)
{
--maxcolor;
/* if (maxit < maxcolor) remove 2 lines */
/* maxcolor = maxit; so that whole palette is always saved */
if (inside > 0 && inside > maxcolor)
maxcolor = inside;
if (outside > 0 && outside > maxcolor)
maxcolor = outside;
if (distest < 0 && 0 - distest > maxcolor)
maxcolor = 0 - distest;
if (decomp[0] > maxcolor)
maxcolor = decomp[0] - 1;
if (potflag && potparam[0] >= maxcolor)
maxcolor = potparam[0];
if (++maxcolor > 256)
maxcolor = 256;
if (colorstate == 0)
{ /* default colors */
if (mapdacbox)
{
colorspec[0] = '@';
sptr = MAP_name;
}
}
else
if (colorstate == 2)
{ /* colors match colorfile */
colorspec[0] = '@';
sptr = colorfile;
}
else /* colors match no .map that we know of */
colorspec[0] = 'y';
if (colorspec[0] == '@')
{
if ((sptr2 = strrchr(sptr, SLASHC)))
sptr = sptr2 + 1;
if ((sptr2 = strrchr(